Sort the test suite's leaf imports and reformat two test bodies - #96
Sort the test suite's leaf imports and reformat two test bodies#96leaf-agent wants to merge 1 commit into
Conversation
ruff-check's isort rule and ruff-format both rewrite files on main, so the lint job fails. The submodule imports the recent module splits introduced (leaf.registry, leaf.served_state, leaf.validation.command) were placed beside the leaf package's flat imports rather than after them, and two call sites exceed the line width after the moves.
|
Verification against current
|
|
Closing as superseded:
Verified on
How this thread ended hereThis PR was opened for run 33186976619 and re-cited for 33188325531. The same That is the fourth import-order break to reach |
Problem
lintis red onmain.ruff check --fixandruff formatboth rewrite files undertests/, and the pre-commit action fails on any hook that modifies a file. The failing run reported one autofix; three more commits have landed since, somainnow carries 8I001import-order errors and 2 unformatted files.The cause is the recent module splits.
leaf.registry,leaf.served_state,leaf.validation.command, andleaf.render_gateare submodule imports, which isort orders after the flatfrom leaf import …block — but each new import was inserted alphabetically among the flat ones (from leaf.served_state import pagebetweenfrom leaf import schemaandfrom leaf import server). Separately,interact_support.page_stateandrender_cases_widgets.written_anchorsfit within the line width once their call targets were renamed by those same splits.Solution
Ran
ruff@0.16.1 check --fix .andruff@0.16.1 format .— exactly what theruff-checkandruff-formatpre-commit hooks do. No behavior change: every hunk is an import moved within its own block, or a call rewrapped.Branched from
47f1c35, not the failing run'sae66e73, so the fix covers all four commits that accumulated the drift rather than just the first.Testing
The four rewritten
test_interact_*modules pass —391 passed— confirming the reordered imports still resolve.Files changed
tests/interact_support.pyleaf.served_stateimport order;page_staterewrappedtests/render_cases_layout.pyleaf.registryimport ordertests/render_cases_widgets.pywritten_anchorstuple rewrappedtests/test_interact_contract.pyleaf.registryimport order (4)tests/test_interact_product.pyleaf.validation.command,leaf.registryimport ordertests/test_interact_server.pyleaf.registry,leaf.served_stateimport order (3)tests/test_interact_session.pyleaf.registry,leaf.served_stateimport order (3)tests/test_render_controls.pyleaf.registryimport ordertests/test_render_pages.pyleaf.registryimport orderAutomated fix for failed run